package com.wolfeyes.web.controller.system;

import com.wolfeyes.common.response.ResponseResult;
import com.wolfeyes.system.domain.SysActorMovie;
import com.wolfeyes.system.service.impl.SysActorMovieServiceImpl;
import com.wolfeyes.web.controller.BaseController;

import lombok.RequiredArgsConstructor;

//import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @see Talk is cheap, Show me the code. -- Linus Torvalds
 * @title 电影演员-控制器
 * @author yanyljava
 * @email yanyljava@qq.com
 * @create 2022-01-17 10:36
 */
@RestController
@RequiredArgsConstructor
public class SysActorMovieController extends BaseController {

    //@Autowired
    private final SysActorMovieServiceImpl sysActorMovieService;

    @GetMapping("/sysActorMovie")
    public ResponseResult findAll(SysActorMovie sysActorMovie){
        startPage();
        return getResult(sysActorMovieService.findAll(sysActorMovie));
    }

    @PostMapping("/sysActorMovie")
    public ResponseResult add(@Validated @RequestBody SysActorMovie sysActorMovie){
        return getResult(sysActorMovieService.add(sysActorMovie));
    }

    @DeleteMapping("/sysActorMovie/{movieId}/{actorId}/{actorRoleId}")
    public ResponseResult delete(@PathVariable Long movieId, @PathVariable Long actorId, @PathVariable Long actorRoleId){
        return getResult(sysActorMovieService.delete(new SysActorMovie(movieId, actorId, actorRoleId)));
    }

}
